<?php
header("Content-Type: text/html; charset=iso-8859-1");
require_once('include.php');
$user_id = check_cookie();
$type = (!empty($_REQUEST['type'])) ? $_REQUEST['type'] : "";
$membre = (!empty($_REQUEST['membre'])) ? $_REQUEST['membre'] : "";
$contenu = (!empty($_REQUEST['contenu'])) ? $_REQUEST['contenu'] : "";
$id_info = (!empty($_REQUEST['id_info'])) ? $_REQUEST['id_info'] : "";
if($membre != $user_id || !$contenu || !$id_info) exit;
$contenu = ereg_replace("_(.*)?_","<span class = 'italic'>\\1</span>",$contenu);
$contenu = ereg_replace("\*(.*)?\*","<span class = 'bold'>\\1</span>",$contenu);
$contenu = ereg_replace("cit%(.*)?%\.(.*)?%%","<p class = 'erreur'><span class = 'bold'>\\1 a &eacute;crit : </span><br /><br />\\2</p>",$contenu);
$contenu = ereg_replace("\"(.*)?\":http://([^\ ]*)?"," <a href = 'http://\\2'>\\1</a>",$contenu);
if(!get_magic_quotes_gpc()) $contenu = addslashes($contenu);
$q = "insert into commentaires_$type (membre_id,contenu,info_id,datetime) values ($membre,'".($contenu)."',$id_info,now())";
if(ExecRequete($q)) echo "ok";
else echo "ko";

?>
